package com.it.controller;

import com.alibaba.fastjson.JSON;
import com.it.pojo.MyCoupon;
import com.it.pojo.MyWallet;
import com.it.service.MyCouponService;
import com.it.service.MyThresholdService;
import com.it.service.MyWalletService;
import com.it.service.MyWalletcoupons1Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@Api("展示用户钱包详情,以及查询各类型红包数量")
public class MyBagController {
    @Resource
    MyCouponService myCouponService;
    @Resource
    MyThresholdService myThresholdService;
    @Resource
    MyWalletcoupons1Service myWalletcoupons1Service;
    @Resource
    MyWalletService myWalletService;
    @ApiOperation(value = "查询余额以及各类型红包数量")
    @RequestMapping("/getAll/{uid}")
    public MyWallet selectAll(@PathVariable Integer uid){
/*        MyWallet myWallet = myWalletService.selectAll(uid);
        String s = JSON.toJSONString(myWallet);*/
        return myWalletService.selectAll(uid);
    }
    @ApiOperation(value = "查询满减类型红包数量")
    @RequestMapping("/getCoupons/{ownerid}")
    public List<MyCoupon> selectCouponsByOwnerId(@PathVariable Integer ownerid) {
/*        List<MyCoupon> myCoupons = myCouponService.selectCouponsByOwnerId(ownerid);
        String s = JSON.toJSONString(myCoupons);*/
        return myCouponService.selectCouponsByOwnerId(ownerid);
    }
    @ApiOperation(value = "查询无门槛类型红包数量")
    @RequestMapping("/getThreshold/{ownerid}")
    public List<MyCoupon> selectThresholdByOwnerId(@PathVariable Integer ownerid) {
/*        List<MyCoupon> myCoupons = myCouponService.selectThresholdByOwnerId(ownerid);
        String s = JSON.toJSONString(myCoupons);*/
        return myCouponService.selectThresholdByOwnerId(ownerid);
    }
}
